﻿
'*******************************************************************
' Program: Data Center Visio Rack Tool
' Author: Albert E Edlund
' Date:
'
' Purpose:
'
'
'
'*******************************************************************


Imports Microsoft.Practices.EnterpriseLibrary.Common
Imports Microsoft.Practices.EnterpriseLibrary.Data
Imports Microsoft.Practices.EnterpriseLibrary.ExceptionHandling
Imports Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging


Imports System
Imports System.ComponentModel
Imports System.Collections.Generic

Public Class dc_Network
    Implements INotifyPropertyChanged


#Region "Events"

    Public Event PropertyChanged(ByVal sender As Object, ByVal e As System.ComponentModel.PropertyChangedEventArgs) Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged

    Private Sub OnPropertyChanged(ByVal info As String)
        RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(info))
    End Sub

#End Region

#Region " Constructor "

    Public Sub New()
        initProperties()
    End Sub

    Public Sub New(ByVal strUserId As String)
        initProperties()
        Me.m_attrnetLastEdit = strUserId
    End Sub

#End Region

#Region " Properties and Fields "


    Public Enum netStatus
        netUnitialized = -1
        netActive = 0
        netErrors = 1
        netAdminDown = 2
        netUnknown = 3
        netUndefined = 4
        netAvailable = 5
        netUnavailable = 6
    End Enum


    Const constAttrNetKey As Int32 = -1
    Private m_attrnetKey As Int32
    Property attrnetKey() As Int32
        Get
            Return Me.m_attrnetKey
        End Get
        Set(ByVal value As Int32)
            Me.m_attrnetKey = value
            Me.OnPropertyChanged("attrnetKey")
        End Set
    End Property

    Const constAttrNetPortKey As Int32 = -1
    Private m_attrnetPortKey As Int32
    Property attrnetPortKey() As Int32
        Get
            Return Me.m_attrnetPortKey
        End Get
        Set(ByVal value As Int32)
            Me.m_attrnetPortKey = value
            Me.OnPropertyChanged("attrnetPortKey")
        End Set
    End Property

    Const constAttrNetCompKey As Int32 = -1
    Private m_attrnetCompKey As Int32
    Property attrnetCompKey() As Int32
        Get
            Return Me.m_attrnetCompKey
        End Get
        Set(ByVal value As Int32)
            Me.m_attrnetCompKey = value
            Me.OnPropertyChanged("attrnetCompKey")
        End Set
    End Property

    Const constAttrNetDomainName As String = "na"
    Private m_attrnetDomainName As String
    Property attrnetDomainName() As String
        Get
            Return Me.m_attrnetDomainName
        End Get
        Set(ByVal value As String)
            Me.m_attrnetDomainName = value
            Me.OnPropertyChanged("attrnetDomainName")
        End Set
    End Property

    Const constAttrNetNetworkName As String = "na"
    Private m_attrnetNetworkName As String
    Property attrnetNetworkName() As String
        Get
            Return Me.m_attrnetNetworkName
        End Get
        Set(ByVal value As String)
            Me.m_attrnetNetworkName = value
            Me.OnPropertyChanged("attrnetNetworkName")
        End Set
    End Property

    Const constAttrNetIpAddress As String = "0.0.0.0"
    Private m_attrnetIpAddress As String
    Property attrnetIpAddress() As String
        Get
            Return Me.m_attrnetIpAddress
        End Get
        Set(ByVal value As String)
            Me.m_attrnetIpAddress = value
            Me.OnPropertyChanged("attrnetIpAddress")
        End Set
    End Property

    Const constAttrNetSubnetMask As String = "255.255.255.0"
    Private m_attrnetSubnetMask As String
    Property attrnetSubnetMask() As String
        Get
            Return Me.m_attrnetSubnetMask
        End Get
        Set(ByVal value As String)
            Me.m_attrnetSubnetMask = value
            Me.OnPropertyChanged("attrnetSubnetMask")
        End Set
    End Property

    Const constAttrNetMacAddress As String = "01:23:45:67:89:ab"
    Private m_attrnetMacAddress As String
    Property attrnetMacAddress() As String
        Get
            Return Me.m_attrnetMacAddress
        End Get
        Set(ByVal value As String)
            Me.m_attrnetMacAddress = value
            Me.OnPropertyChanged("attrnetMacAddress")
        End Set
    End Property

    Const constAttrNetWWNID As String = "00:00:00:00:00:00:00:00"
    Private m_attrnetWWNID As String
    Property attrnetWWNID() As String
        Get
            Return Me.m_attrnetWWNID
        End Get
        Set(ByVal value As String)
            Me.m_attrnetWWNID = value
            Me.OnPropertyChanged("attrnetWWNID")
        End Set
    End Property

    Const constAttrNetStatus As netStatus = netStatus.netUndefined
    Private m_attrnetStatus As netStatus
    Property attrnetStatus() As netStatus
        Get
            Return Me.m_attrnetStatus
        End Get
        Set(ByVal value As netStatus)
            If Not TypeDescriptor.GetConverter(GetType(netStatus)).IsValid(value) Then
                ' Throw New ArgumentException()
                value = netStatus.netUndefined
            End If
            Me.m_attrnetStatus = value
            Me.OnPropertyChanged("attrnetStatus")
        End Set
    End Property

    Const constAttrNetStatusDate As Date = #1/1/2001#
    Private m_attrnetStatusDate As Date
    Property attrnetStatusDate() As Date
        Get
            Return Me.m_attrnetStatusDate
        End Get
        Set(ByVal value As Date)
            Me.m_attrnetStatusDate = value
            Me.OnPropertyChanged("attrnetStatusDate")
        End Set
    End Property

    Const constAttrNetComments As String = "none"
    Private m_attrnetComments As String
    Property attrnetComments() As String
        Get
            Return Me.m_attrnetComments
        End Get
        Set(ByVal value As String)
            Me.m_attrnetComments = value
            Me.OnPropertyChanged("attrnetComments")
        End Set
    End Property

    Const constAttrNetLastUpdate As Date = #1/1/2001#
    Private m_attrnetLastUpdate As Date
    Property attrnetLastUpdate() As Date
        Get
            Return Me.m_attrnetLastUpdate
        End Get
        Set(ByVal value As Date)
            Me.m_attrnetLastUpdate = value
            Me.OnPropertyChanged("attrnetLastUpdate")
        End Set
    End Property

    Const constAttrNetLastEdit As String = "na"
    Private m_attrnetLastEdit As String
    Property attrnetLastEdit() As String
        Get
            Return Me.m_attrnetLastEdit
        End Get
        Set(ByVal value As String)
            Me.m_attrnetLastEdit = value
            Me.OnPropertyChanged("attrnetLastEdit")
        End Set
    End Property


#End Region

#Region " Methods "


    Public Sub initProperties()

        Try

            attrnetKey = constAttrNetKey
            attrnetPortKey = constAttrNetPortKey
            attrnetCompKey = constAttrNetCompKey
            attrnetDomainName = constAttrNetDomainName
            attrnetNetworkName = constAttrNetNetworkName
            attrnetIpAddress = constAttrNetIpAddress
            attrnetSubnetMask = constAttrNetSubnetMask
            attrnetMacAddress = constAttrNetMacAddress
            attrnetWWNID = constAttrNetWWNID
            attrnetStatus = constAttrNetStatus
            attrnetStatusDate = constAttrNetStatusDate
            attrnetComments = constAttrNetComments
            attrnetLastEdit = constAttrNetLastEdit
            attrnetLastUpdate = Now

        Catch ex As Exception
            Dim rethrow As Boolean = ExceptionPolicy.HandleException(ex, "Log Only Policy")
            If (rethrow) Then
                Throw
            End If
        End Try

    End Sub




#End Region


End Class


